<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>雨霖铃课后练习</title>
   <link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style2.css">
	
</head>   
<body>

    <section class="box">
        <div class="box-block"></div>
        <div class="box-text">
            <div class="text-title">
				<div class="f"><h1>1.《雨霖铃·寒蝉凄切》是宋词著名作品，其作
者是北宋婉约派词人</h1>
					
				    <div class="e">
                           <div class="a"><h5>A. 柳永</h5>
</div>
                           <div class="b"><h5>B.  晏殊</h5>
</div>
                           <div class="c"><h5>C. 欧阳修</h5>
</div>
                           <div class="d"><h5>D. 李清照</h5>
</div>
				<div class="g"> 
				<input type="radio" name="q1" value="A"></div>
				<div class="h"> <input type="radio" name="q1" value="B"></div>
				<div class="y"> <input type="radio" name="q1" value="C"></div>
				<div class="k"> <input type="radio" name="q1" value="D"></div>
						
						
						
                    </div>
               </div>
		 </div>
	</div>
    </section>

    <section class="box">
        <div class="box-block"></div>
        <div class="box-text">
            <div class="text-title">
				<div class="f"><h1>2.对“寒蝉凄切，对长亭晚，骤雨初歇”三句的作用理解正确的一项是</h1>
				    <div class="e">
                           <div class="a"><h5>A.渲染功业无成的伤感。</h5>
</div>
                           <div class="b"><h5>B. 运用比喻，使形象更加鲜明。</h5>
</div>
                           <div class="c"><h5>C. 交代离别的时间、地点和环境。</h5>
</div>
                           <div class="d"><h5>运用排比增强气势。</h5>
</div>
				<div class="g"> 
				<input type="radio" name="q2" value="A"></div>
				<div class="h"> <input type="radio" name="q2" value="B"></div>
				<div class="y"> <input type="radio" name="q2" value="C"></div>
				<div class="k"> <input type="radio" name="q2" value="D"></div>
						
						
						
                    </div>
               </div>
		 </div>
	</div>
    </section>

    <section class="box">
        <div class="box-block"></div>
        <div class="box-text">
            <div class="text-title">
				<div class="f"><h1>3.对“执手相看泪眼，竟无语凝噎”的写作技法理解正确的一项是</h1>
				    <div class="e">
                           <div class="a"><h5>A. 运用夸张手法，表现人物感情。</h5>
</div>
                           <div class="b"><h5>B. 运用白描手法，写人物动作、情态。</h5>
</div>
                           <div class="c"><h5>C. 运用人物行为，烘托离愁别绪.</h5>
</div>
                           <div class="d"><h5>D. 运用虚拟想象手法，表达深厚的感情。</h5>
</div>
				<div class="g"> 
				<input type="radio" name="q3" value="A"></div>
				<div class="h"> <input type="radio" name="q3" value="B"></div>
				<div class="y"> <input type="radio" name="q3" value="C"></div>
				<div class="k"> <input type="radio" name="q3" value="D"></div>
						
						
						
                    </div>
               </div>
		 </div>
	</div>
    </section>

    <section class="box">
        <div class="box-block"></div>
       <div class="box-text">
            <div class="text-title">
				<div class="f"><h1>4.“今宵酒醒何处？杨柳岸晓风残月”这句话描绘的“景”和“情”分别是</h1>
				    <div class="e">
                           <div class="a"><h5>A. 幽静的恬淡的</h5>
</div>
                           <div class="b"><h5>B. 清凉的空虚的</h5>
</div>
                           <div class="c"><h5>C. 凄冷的凄苦的</h5>
</div>
                           <div class="d"><h5>D. 明丽的烦恼的</h5>
</div>
				<div class="g"> 
				<input type="radio" name="q4" value="A"></div>
				<div class="h"> <input type="radio" name="q4" value="B"></div>
				<div class="y"> <input type="radio" name="q4" value="C"></div>
				<div class="k"> <input type="radio" name="q4" value="D"></div>
						
						
						
                    </div>
               </div>
		 </div>
	</div>
    </section>

    <section class="box">
        <div class="box-block"></div>
        <div class="box-text">
            <div class="text-title">
				
				<div class="t"><button style="background-color: #dc9f46; color: white; border-radius: 10px; padding: 10px 20px;" onclick="submitAnswers()">提交</button>
             <h5>您的得分是: <span id="score"></span></h5>
							
				
	
				
				
				
				</div>
				<form class="rating">
					<div class="rating__stars">
						<input id="rating-1" class="rating__input rating__input-1" type="radio" name="rating" value="1">
						<input id="rating-2" class="rating__input rating__input-2" type="radio" name="rating" value="2">
						<input id="rating-3" class="rating__input rating__input-3" type="radio" name="rating" value="3">
						<input id="rating-4" class="rating__input rating__input-4" type="radio" name="rating" value="4">
						<input id="rating-5" class="rating__input rating__input-5" type="radio" name="rating" value="5">
						<label class="rating__label" for="rating-1">
							<svg class="rating__star" width="32" height="32" viewBox="0 0 32 32" aria-hidden="true">
								<g transform="translate(16,16)">
									<circle class="rating__star-ring" fill="none" stroke="#000" stroke-width="16" r="8" transform="scale(0)" />
								</g>
								<g stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
									<g transform="translate(16,16) rotate(180)">
										<polygon class="rating__star-stroke" points="0,15 4.41,6.07 14.27,4.64 7.13,-2.32 8.82,-12.14 0,-7.5 -8.82,-12.14 -7.13,-2.32 -14.27,4.64 -4.41,6.07" fill="none" />
										<polygon class="rating__star-fill" points="0,15 4.41,6.07 14.27,4.64 7.13,-2.32 8.82,-12.14 0,-7.5 -8.82,-12.14 -7.13,-2.32 -14.27,4.64 -4.41,6.07" fill="#000" />
									</g>
									<g transform="translate(16,16)" stroke-dasharray="12 12" stroke-dashoffset="12">
										<polyline class="rating__star-line" transform="rotate(0)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(72)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(144)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(216)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(288)" points="0 4,0 16" />
									</g>
								</g>
							</svg>
							<span class="rating__sr">1 star—Terrible</span>
						</label>
						<label class="rating__label" for="rating-2">
							<svg class="rating__star" width="32" height="32" viewBox="0 0 32 32" aria-hidden="true">
								<g transform="translate(16,16)">
									<circle class="rating__star-ring" fill="none" stroke="#000" stroke-width="16" r="8" transform="scale(0)" />
								</g>
								<g stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
									<g transform="translate(16,16) rotate(180)">
										<polygon class="rating__star-stroke" points="0,15 4.41,6.07 14.27,4.64 7.13,-2.32 8.82,-12.14 0,-7.5 -8.82,-12.14 -7.13,-2.32 -14.27,4.64 -4.41,6.07" fill="none" />
										<polygon class="rating__star-fill" points="0,15 4.41,6.07 14.27,4.64 7.13,-2.32 8.82,-12.14 0,-7.5 -8.82,-12.14 -7.13,-2.32 -14.27,4.64 -4.41,6.07" fill="#000" />
									</g>
									<g transform="translate(16,16)" stroke-dasharray="12 12" stroke-dashoffset="12">
										<polyline class="rating__star-line" transform="rotate(0)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(72)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(144)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(216)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(288)" points="0 4,0 16" />
									</g>
								</g>
							</svg>
							<span class="rating__sr">2 stars—Bad</span>
						</label>
						<label class="rating__label" for="rating-3">
							<svg class="rating__star" width="32" height="32" viewBox="0 0 32 32" aria-hidden="true">
								<g transform="translate(16,16)">
									<circle class="rating__star-ring" fill="none" stroke="#000" stroke-width="16" r="8" transform="scale(0)" />
								</g>
								<g stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
									<g transform="translate(16,16) rotate(180)">
										<polygon class="rating__star-stroke" points="0,15 4.41,6.07 14.27,4.64 7.13,-2.32 8.82,-12.14 0,-7.5 -8.82,-12.14 -7.13,-2.32 -14.27,4.64 -4.41,6.07" fill="none" />
										<polygon class="rating__star-fill" points="0,15 4.41,6.07 14.27,4.64 7.13,-2.32 8.82,-12.14 0,-7.5 -8.82,-12.14 -7.13,-2.32 -14.27,4.64 -4.41,6.07" fill="#000" />
									</g>
									<g transform="translate(16,16)" stroke-dasharray="12 12" stroke-dashoffset="12">
										<polyline class="rating__star-line" transform="rotate(0)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(72)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(144)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(216)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(288)" points="0 4,0 16" />
									</g>
								</g>
							</svg>
							<span class="rating__sr">3 stars—OK</span>
						</label>
						<label class="rating__label" for="rating-4">
							<svg class="rating__star" width="32" height="32" viewBox="0 0 32 32" aria-hidden="true">
								<g transform="translate(16,16)">
									<circle class="rating__star-ring" fill="none" stroke="#000" stroke-width="16" r="8" transform="scale(0)" />
								</g>
								<g stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
									<g transform="translate(16,16) rotate(180)">
										<polygon class="rating__star-stroke" points="0,15 4.41,6.07 14.27,4.64 7.13,-2.32 8.82,-12.14 0,-7.5 -8.82,-12.14 -7.13,-2.32 -14.27,4.64 -4.41,6.07" fill="none" />
										<polygon class="rating__star-fill" points="0,15 4.41,6.07 14.27,4.64 7.13,-2.32 8.82,-12.14 0,-7.5 -8.82,-12.14 -7.13,-2.32 -14.27,4.64 -4.41,6.07" fill="#000" />
									</g>
									<g transform="translate(16,16)" stroke-dasharray="12 12" stroke-dashoffset="12">
										<polyline class="rating__star-line" transform="rotate(0)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(72)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(144)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(216)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(288)" points="0 4,0 16" />
									</g>
								</g>
							</svg>
							<span class="rating__sr">4 stars—Good</span>
						</label>
						<label class="rating__label" for="rating-5">
							<svg class="rating__star" width="32" height="32" viewBox="0 0 32 32" aria-hidden="true">
								<g transform="translate(16,16)">
									<circle class="rating__star-ring" fill="none" stroke="#000" stroke-width="16" r="8" transform="scale(0)" />
								</g>
								<g stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
									<g transform="translate(16,16) rotate(180)">
										<polygon class="rating__star-stroke" points="0,15 4.41,6.07 14.27,4.64 7.13,-2.32 8.82,-12.14 0,-7.5 -8.82,-12.14 -7.13,-2.32 -14.27,4.64 -4.41,6.07" fill="none" />
										<polygon class="rating__star-fill" points="0,15 4.41,6.07 14.27,4.64 7.13,-2.32 8.82,-12.14 0,-7.5 -8.82,-12.14 -7.13,-2.32 -14.27,4.64 -4.41,6.07" fill="#000" />
									</g>
									<g transform="translate(16,16)" stroke-dasharray="12 12" stroke-dashoffset="12">
										<polyline class="rating__star-line" transform="rotate(0)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(72)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(144)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(216)" points="0 4,0 16" />
										<polyline class="rating__star-line" transform="rotate(288)" points="0 4,0 16" />
									</g>
								</g>
							</svg>
							
						</label>
						<p class="rating__display" data-rating="1" hidden>加油</p>
						<p class="rating__display" data-rating="2" hidden>你可以的</p>
						<p class="rating__display" data-rating="3" hidden>很棒</p>
						<p class="rating__display" data-rating="4" hidden>非常棒</p>
						<p class="rating__display" data-rating="5" hidden>满分啦</p>
					</div>
				</form>
				
				<div class="ab">
					
					
					<h1>5.下列词语的解释有误的一项是</h1>
				    <div class="aa">
                           <div class="a"><h5>A. 都门帐饮无绪 绪：心情，情绪</h5>
</div>
                           <div class="b"><h5>B. 暮霭沉沉楚天阔 霭：云气，雾气</h5>
</div>
                           <div class="c"><h5>C. 更那堪、冷落清秋节 堪：忍受，承受</h5>
</div>
                           <div class="d"><h5>D. 此去经年经年：一年</h5>
</div>
				<div class="g"> 
				<input type="radio" name="q5" value="A"></div>
				<div class="h"> <input type="radio" name="q5" value="B"></div>
				<div class="y"> <input type="radio" name="q5" value="C"></div>
				<div class="k"> <input type="radio" name="q5" value="D"></div>
						
						
						
                    </div>
               </div>
		 </div>
	</div>
		
     
    </section>

    <script>

        // 获取窗口的高度 
        const wh = window.innerHeight;
        // 监听窗口滚动事件 
        const sectionBlock = Array.from(document.querySelectorAll('.box-block'));
        // 获取所有class为section-item__block的元素，并将其转换为数组 
        window.addEventListener('scroll', () => {
            // 遍历sectionBlock数组中的每个元素
            sectionBlock.forEach(el => {
                // 获取元素相对于视口的位置信息，包括距离视口底部的距离（bottom）、
                // 距离视口顶部的距离（top）和元素的高度（height）
                const { bottom, top, height } = el.getBoundingClientRect();
                // 如果元素完全位于视口之外，或者完全位于视口之上，则不进行任何操作
                if (bottom <= 0 || top >= wh) return;
                // 计算元素的背景位置的y坐标，根据滚动条的位置进行计算 
                const y = document.documentElement.scrollTop * 0.5;
                // 设置元素的背景位置 
                el.style.backgroundPosition = `center -${y}px`;
            });
        });

function submitAnswers() {
    var answers = ["A", "C", "B", "C", "D"]; // 每题的答案
    var score = 0;

    for (var i = 1; i <= answers.length; i++) {
        var selected = document.querySelector('input[name="q' + i + '"]:checked');
        if (selected) {
            if (selected.value === answers[i - 1]) {
                score += 20; // 每题的得分
            }
        } else {
            alert("请回答第" + i + "题");
            return;
        }
    }

    document.getElementById("score").innerText = score; // 显示得分
    document.getElementById("score").style.color = "red";

    var numStars = Math.ceil(score / 20); // 计算需要点亮的星级按钮数量
    for (var j = 1; j <= 5; j++) {
        var starBtn = document.getElementById("rating-" + j);
        if (j <= numStars) {
            // 点亮星级按钮
            starBtn.checked = true;
        } else {
            // 关闭星级按钮
            starBtn.checked = false;
        }
    }
}
    </script>
	<script  src="./script.js"></script> 
</body>

</html>
